<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

/*
 * 前后端api接口通过放到不同的组来实现隔离
 * */
//站点首页
Route::get('/', function () {
    return redirect('/wap/booking/index');
});

Route::get('/test', function () {
    $str='汉口江滩2018年03月20日 17点-19点 6V6 3';


  $res=  \App\Repository\Sys\Sys::SendMessage(3982516,[15994225894],[$str]);

  var_dump($res);
});
//前台api接口,不需要认证的
Route::group(['middleware' => 'no_auth'], function () {
    Route::controller('api/wap', 'Api\WapController');
    Route::controller('api/common', 'Api\CommonController');
});

//前台api接口,需要认证的
Route::group(['middleware' => 'no_auth'], function () {
    Route::controller('api/user', 'Api\UserController');
    Route::controller('api/storefront', 'Api\StorefrontController');
    Route::controller('api/field', 'Api\FieldController');
    Route::controller('api/order', 'Api\OrderController');
    Route::controller('api/team', 'Api\TeamController');
    Route::controller('api/comment', 'Api\CommentController');
});


//后台api接口
Route::group(['middleware' => 'AdminAuth'], function () {  // loginCheck
    Route::controller('adminapi/class', 'AdminApi\ClassController');//分类管理
    Route::controller('adminapi/system', 'AdminApi\SystemController');//系统管理
    Route::controller('adminapi/admin', 'AdminApi\AdminController');//管理员管理

    Route::controller('adminapi/coupon', 'AdminApi\CouponController');
    Route::controller('adminapi/field', 'AdminApi\FieldController');
    Route::controller('adminapi/order', 'AdminApi\OrderController');
    Route::controller('adminapi/other', 'AdminApi\OtherController');
    Route::controller('adminapi/storefront', 'AdminApi\StorefrontController');
    Route::controller('adminapi/team', 'AdminApi\TeamController');
    Route::controller('adminapi/user', 'AdminApi\UserController');
    Route::controller('adminapi/comment', 'AdminApi\CommentController');
    Route::controller('adminapi/userlevel', 'AdminApi\UserLevelController');

});

Route::group(['middleware' => 'AdminAuth'], function () {  // loginCheck
    Route::any('admin/{dir}/{tpl}', function ($dir = null, $tpl = null) {
        if ($dir == null or $tpl == null) {
            abort(404);
        } else {
            return view('admin.' . $dir . '.' . $tpl);
        }
    });

});

//前台原生页面 web en
Route::group(['middleware' => 'no_auth'], function () {
    Route::controller('/wap/news', 'Web\NewsController');
    Route::controller('/wap/service', 'Web\ServiceController');
    Route::controller('/wap/industry', 'Web\IndustryController');
});


//手机端静态页面,前后端分离
Route::group(['middleware' => 'weixin_auth'], function () {// weixin_auth             no_auth

    Route::any('wap/{dir}/{tpl}', function ($dir = null, $tpl = null) {
        if ($dir == null or $tpl == null) {
            abort(404);
        } else {
            return view('wap.' . $dir . '.' . $tpl);
        }
    });


});

